{{define "Title"}}日报表{{end}}
{{define "Content"}}

<script type=text/javascript src="/js/exportToExcel.js"></script>
<script type=text/javascript src="/js/calendar.js"></script>
<script type=text/javascript src="/js/tablestyle.js"></script>

<div class="container-fluid">
<form class="form-horizontal" action="/dailyreport" method="POST">
  <fieldset>
    <legend><b>日报表</b></legend>
    {{if .error}}<div class="alert alert-error"><b>错误: </b>{{.error | html}}</div>
    {{end}}
    <div class="control-group">
      <label class="control-label">查询日期&nbsp;</label>
      <div class="control">
        <input class="input-large" id="fromdate" name="fromdate" style="background-color: #FFFFD0" onfocus="setday(this);" size="20"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">物料&nbsp;</label>
      <div class="control">
        <select id="item" name="item" onkeydown="clicka();">
          <option value="">
          {{range .items}}
            <option value="{{.Item | html}}">{{.Item | html}}  |  {{.Desc | html}}
          {{end}}
        </select>
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">查询</button>
    </div>
    {{if .dl_ls}}
      <div class="control">
        <input type=button class="btn btn-primary" id="toexcel" value="导出到Excel" onclick="getXlsFromTbl('tbl_ls', null);">
      </div>
    {{end}}
  </fieldset>
</form>
</div>

{{if .dl_ls}}
<div class="control-group">
  <label class="control-label">查询的日期范围: <b>{{.from_datetime | html}} - {{.to_datetime | html}}</b></label>
</div>
<div class="control-group">
  <label class="control-label">物料: <b>{{.item | html}}</b></label>
</div>
<div class="content-box" style="width:6000px">
    <div class="content-box-header">
      <p style="font-size: 16px;">&nbsp;&nbsp;<b>日报表明细</b></p>
    </div>
<table id="tbl_ls" border="1" cellspacing="0" cellpadding="0" style="font-size:100%">
  <thead>
    <tr>
      <th rowspan='2' style="text-align:center">站点</th>
      <th colspan='3' style="text-align:center">00:00~01:00</th>
      <th colspan='3' style="text-align:center">01:00~02:00</th>
      <th colspan='3' style="text-align:center">02:00~03:00</th>
      <th colspan='3' style="text-align:center">03:00~04:00</th>
      <th colspan='3' style="text-align:center">04:00~05:00</th>
      <th colspan='3' style="text-align:center">05:00~06:00</th>
      <th colspan='3' style="text-align:center">06:00~07:00</th>
      <th colspan='3' style="text-align:center">07:00~08:00</th>
      <th colspan='3' style="text-align:center">08:00~09:00</th>
      <th colspan='3' style="text-align:center">09:00~10:00</th>
      <th colspan='3' style="text-align:center">10:00~11:00</th>
      <th colspan='3' style="text-align:center">11:00~12:00</th>
      <th colspan='3' style="text-align:center">12:00~13:00</th>
      <th colspan='3' style="text-align:center">13:00~14:00</th>
      <th colspan='3' style="text-align:center">14:00~15:00</th>
      <th colspan='3' style="text-align:center">15:00~16:00</th>
      <th colspan='3' style="text-align:center">16:00~17:00</th>
      <th colspan='3' style="text-align:center">17:00~18:00</th>
      <th colspan='3' style="text-align:center">18:00~19:00</th>
      <th colspan='3' style="text-align:center">19:00~20:00</th>
      <th colspan='3' style="text-align:center">20:00~21:00</th>
      <th colspan='3' style="text-align:center">21:00~22:00</th>
      <th colspan='3' style="text-align:center">22:00~23:00</th>
      <th colspan='3' style="text-align:center">23:00~00:00</th>
      <th colspan='3' style="text-align:center">Subtotal</th>
    </tr>
    <tr>
      {{range .tableHead}}
      {{$cur := .}}
      <td>{{index $cur 0 | html}}</td>
      <td>{{index $cur 1 | html}}</td>
      <td>{{index $cur 2 | html}}</td>
      {{end}}
    </tr>
  </thead>
  <tbody id="group_one">
  {{range .dl_ls}}
  {{$curls := .}}
  <tr>
    <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Station | html}}</td>
    {{range .Details}}
      {{if .ValPass}}
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/dailydetail?nm={{.ValPass | html}}&fd={{$curls.BeginDate | html}}&td={{$curls.EndDate | html}}&im={{$curls.Item | html}}&st={{$curls.Station | html}}&ho={{.Hours | html}}&ts=PASS">{{.ValPass | html}}</a></td>
      {{else}}
        <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
      {{end}}
      {{if .ValFail}}
        <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/dailydetail?nm={{.ValFail | html}}&fd={{$curls.BeginDate | html}}&td={{$curls.EndDate | html}}&im={{$curls.Item | html}}&st={{$curls.Station | html}}&ho={{.Hours | html}}&ts=FAIL">{{.ValFail | html}}</a></td>
      {{else}}
        <td fieldset style="color: #666666; border-style: groove; font-size: 14px">0</td>
      {{end}}
      <td fieldset style="color: #666666; border-style: groove; font-size: 14px">{{.PassYield | html}}</td>
    {{end}}
  </tr>
  {{end}}
  </tbody>
</table>
</div>
{{end}}
{{end}}